Sockets or data sockets enable network-capable applications (e.g., Internet and intranet) to communicate application data (e.g., between applications) across wired and/or wireless communication channels, independent of the network protocol being used. Generally, sockets are implemented through use of an application programming interface (API) configured to allow interaction between an operating system (OS) and an application operating on a computing device. For example, the API may be used to send and receive data over a network using Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) connections.
The API may be, for example, Winsock, Websock or Chrome.socket. Typically, sockets remain open over the lifetime of an application. However, in some cases a socket may be closed, have brief lifetimes and/or be intermittently active regardless of the lifetime of the application. For example, in Websock an idle time setting may be 10 seconds. This idle time setting may be a default setting or be dynamically set. If the application does not use the socket (e.g., send or receive data) the socket may be closed. In other cases, the socket may be closed if an application is minimized and/or if a tab (e.g., in a tabbed browser) the application is operating in is not selected.
Typically the socket is closed to conserve resources. However, closing the socket may degrade a user experience. For example, the user experience may be degraded because a new socket may need to be opened resulting in perceived delays and/or data may not be received or received in a timely manner. As another example of conserving while there is no activity on a socket, an application waiting for connections on a TCP port (e.g. a FTP server, an HTTP server, etc.) using the “listen/accept” socket primitive (also referred to as server socket). In this example, the application, after issuing a “listen/accept” on a given TCP port, could be “unloaded” at any time by the runtime, and “re-loaded” when a client application makes a connection to the port (e.g., to the server socket”).
As a result, there is a need to maintain a socket connectivity while also conserving system resources when a socket (being used by an application) is inactive.